-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created and updated times #56
base: main
Are you sure you want to change the base?
Conversation
I think so 👍! It was a while since I messed with the Lezer stuff, and the Lezer code in Heynote is the full extent of my experience with it, so I'm certainly not an expert when it comes to the grammar syntax. |
A thought that popped up in my mind when thinking about this.. I think it would be a good idea to investigate how we could implement the actual updating of the timestamps in the Codemirror text buffer. I'm guessing that this should be done with some kind of transactionFilter, but the text in the reference manual seems to indicate that it might not be a very good idea. So it's probably smart to investigate that to make sure it's not a showstopper due to performance issues or similar. |
We would only need a |
a70a0bd
to
9e68f54
Compare
@@ -131,6 +135,8 @@ | |||
:theme="theme" | |||
:systemTheme="systemTheme" | |||
:allowBetaVersions="settings.allowBetaVersions" | |||
:createdTime="createdTime" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't currently show the createdTime
, so these props could be removed.
If you want to show the createdTime
somewhere, then the prop could be kept
<div class="status-block line-number" v-if="updatedTime !== ''"> | ||
Updated <span class="num">{{ updatedTime }}</span> | ||
<!-- Show the created time as well -- too verbose --> | ||
<!-- <span v-if="createdTime !== updatedTime"> (Created {{ createdTime }})</span> --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looked too busy to me. Perhaps the better UI would be to click on the udpated time to see the created time? That wouldn't be clear either though.
Feel free to adjust this as you see it
|
||
const languageTokensMatcher = LANGUAGES.map(l => l.token).join("|") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to copy this snippet over a few times - perhaps this goes in languges.js
and can be imported?
if (state.doc.sliceString(block.delimiter.from, block.delimiter.to).match(delimRegex)) { | ||
//console.log("changing language to", language) | ||
const createdTimeStr = block.time.created || "" | ||
const updatedTimeStr = block.time.updated ? newUpdatedTime() : "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't explicitly needed - this will get updated by the transactionFilter
, but it doesn't hurt to add it since the other function has the transactionFilter
has the debounce
@@ -23,7 +24,7 @@ export const noteContent = new ExternalTokenizer((input) => { | |||
// so we don't need to check for the rest of the token | |||
if (current === FIRST_TOKEN_CHAR && next === SECOND_TOKEN_CHAR) { | |||
let potentialLang = ""; | |||
for (let i=0; i<18; i++) { | |||
for (let i=0; i<62; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note I added the 40 characters of the times to this.
Note I updated the `delimRegex` here to use the similar pattern elsewhere
@heyman this is "ready to go" but I'm having trouble solving two (known) bugs:
Any insight on either? |
Add created/updated timestamps to block delimiter (#30)
New delimiter format with
-c
for created time and-u
for updated time with ISO strings following (YYYY-MM-DDTHH:mm:ssZ
)\n∞∞∞(${languageTokensMatcher})(-a)?(-c${timeMatcher})?(-u${timeMatcher})?\n
Presents the updated time in the status bar: